package net.bolue.console.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.bolue.sysmng.console.ColInfoAdmin;
import net.bolue.sysmng.exception.BolueException;
import net.bolue.web.mvc.AbstractAction;
import net.bolue.web.mvc.ActionResult;
import net.bolue.web.report.RepConstants;
import net.bolue.web.util.RequestUtil;

public class BuildTabls extends AbstractAction{

	@Override
	public ActionResult perform(HttpServletRequest request,
			HttpServletResponse response) throws BolueException {
		String subSys = RequestUtil.getParamValue(request, RepConstants.REP_SUBSYS_KEY);
		String selTbls = RequestUtil.getParamValue(request, "selTbls");
		if(subSys==null || subSys.trim().length()==0||selTbls==null || selTbls.trim().length()==0){
			throw new BolueException(1,"必须提供subSys和selTbls参数值!");
		}
		String [] selTblArray = selTbls.split(",");
		ColInfoAdmin colInfoAdmin = new ColInfoAdmin();
		colInfoAdmin.insertBatchTblInfos(subSys, selTblArray);
		
		ActionResult actionResult = new ActionResult();
		boolean result = true;
		actionResult.setResult(result);
		actionResult.setIsRedirect(1);
		actionResult.setMsg("已成功地添加或修正了数据表列信息,请检验并做相应修正！");
		actionResult.setUrlPath("sysmng.report.do?subSys="+subSys+"&repID=6&cnd_SUBSYS="+subSys+"&cnd_TBLNAME="+selTbls);
		return actionResult;
	}

}
